<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Cristor计算机系统的笔记 | Cristor404</title><meta name="author" content="Cristor404"><meta name="copyright" content="Cristor404"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="记录一些计算机系统知识的笔记">
<meta property="og:type" content="article">
<meta property="og:title" content="Cristor计算机系统的笔记">
<meta property="og:url" content="https://cristor404.gitee.io/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/index.html">
<meta property="og:site_name" content="Cristor404">
<meta property="og:description" content="记录一些计算机系统知识的笔记">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage1.big-bit.com%2F2021%2F0510%2F20210510024124509.jpeg&refer=http%3A%2F%2Fimage1.big-bit.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1672154822&t=49b9b7598a8c874b43bcce547cc000a3">
<meta property="article:published_time" content="2022-09-20T12:30:00.000Z">
<meta property="article:modified_time" content="2022-11-27T15:27:21.663Z">
<meta property="article:author" content="Cristor404">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage1.big-bit.com%2F2021%2F0510%2F20210510024124509.jpeg&refer=http%3A%2F%2Fimage1.big-bit.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1672154822&t=49b9b7598a8c874b43bcce547cc000a3"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://cristor404.gitee.io/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Cristor计算机系统的笔记',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-11-27 23:27:21'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/css/mouse.css"><meta name="generator" content="Hexo 6.3.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://s2.loli.net/2022/09/19/8IjdtLPKe9b7vUg.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">8</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 访达</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage1.big-bit.com%2F2021%2F0510%2F20210510024124509.jpeg&amp;refer=http%3A%2F%2Fimage1.big-bit.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1672154822&amp;t=49b9b7598a8c874b43bcce547cc000a3')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Cristor404</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 访达</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Cristor计算机系统的笔记</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-09-20T12:30:00.000Z" title="发表于 2022-09-20 20:30:00">2022-09-20</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-11-27T15:27:21.663Z" title="更新于 2022-11-27 23:27:21">2022-11-27</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F/">计算机系统</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Cristor计算机系统的笔记"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="《计算机系统基础知识》-の笔记"><a href="#《计算机系统基础知识》-の笔记" class="headerlink" title="《计算机系统基础知识》 の笔记"></a><em>《计算机系统基础知识》</em> の笔记</h1><h2 id="计算机的基本硬件系统组成"><a href="#计算机的基本硬件系统组成" class="headerlink" title="计算机的基本硬件系统组成"></a>计算机的基本硬件系统组成</h2><blockquote>
<p>运算器 控制器 存储器 输入设备 输出设备 等<br><br>其中<br><strong>运算器+控制器 &#x3D; CPU</strong><BR><br><strong>这些两个部件被集成在一起称为中央处理单元</strong></p>
</blockquote>
<h3 id="CPU"><a href="#CPU" class="headerlink" title="CPU:"></a><strong>CPU:</strong></h3><p><strong>运算器+控制器 &#x3D; CPU</strong><BR></p>
<h4 id="运算器："><a href="#运算器：" class="headerlink" title="运算器："></a><strong>运算器：</strong></h4><p>主要做运算：所有的 与或非(逻辑) 加减乘除 附加(算数)….. 以及加工数据<BR><br>运算器包括的部件有：</p>
<ul>
<li><p>算术逻辑单元(ALU): <BR>是运算器的重要组成部件，负责处理数据(算数运算，逻辑运算)<BR></p>
</li>
<li><p><strong>累加寄存器(AC)：</strong><BR><br>是一个通用寄存器(暂时存数据用的)，它为ALU服务，当AUL执行算数或者逻辑运算时，他提供一个工作区。（比如ALU需要做一个减法 从内存中读取被减数到AC，然后再取减数到AC，然后结果也存AC里面，也就是说 一个ALU必须要有1个或者1个以上AC。)<BR></p>
</li>
<li><p><strong>数据缓冲寄存器(DR)：</strong><BR><br>作为CPU和内存、外部设备之间的数据传送的中转站；因为CPU和内存处理数据的速度不一致，所以需要DR来进行缓冲。个人理解为缓存。<BR></p>
</li>
<li><p><strong>状态条件寄存器(PSW)：</strong><BR><br>执行完算数指令之后，建立一个条件码的内容，比如1-1&#x3D;0；它就会给一个运算结果为0的标志…(不太了解)</p>
</li>
</ul>
<h4 id="控制器："><a href="#控制器：" class="headerlink" title="控制器："></a><strong>控制器：</strong></h4><p>主要用于 产生指令的操作信号 并且将这个信号送往相应的部件进行处理 控制指令执行顺序….<br><br><br><strong>运算器</strong>只能完成运算，但是<strong>控制器</strong>却能控制整个CPU的工作，它决定了CPU执行过程的自动化。<BR><br>它的任务：1.保证程序正确执行 2.处理异常事件<BR><br><strong>这里引入一个概念：</strong><BR><br>指令 &#x3D; 操作码  +  地址码<br><BR></p>
<p>它包括的部件有：</p>
<ul>
<li><p><strong>指令寄存器(IR)：</strong><BR><br>CPU执行指令时，从内存中取数据存入DR(运算器中的DR)中,然后再送入IR暂存，指令译码器(ID)再对IR内的内容产生各种微操作指令，控制其他组成的部件工作，完成所需的功能。<BR><br>个人理解为 暂存一下指令 的一个元器件<br>而且操作码和地址码都要存在IR里面<BR><br>且用户无法直接访问IR内的数据</p>
</li>
<li><p><strong>☆☆程序计数器(PC):</strong><BR><br>PC可以寄存信息和计数(两种功能)<BR><br>程序的执行分两种情况，一是顺序执行， 二是转移执行。在程序开始执行前，将程序的起始地址送入PC,该地址在程序加载到内存时确定，因此PC的内容即是程序第一条指令的地址。执行指令时，CPU自动修改PC的内容，以使使其保持的总是将要执行的下一条指令的地址。 由于大多数指令都是按顺序来执行的，所以修改的过程通常只是简单地对PC加1.当遇到转移指令时，后继指令的地址根据当前指令的地址加上一个向前或向后转移的位移量得到，或者根据转移指令给出的直接转移的地址得到。</p>
<p>可以简单理解为：PC+1就可以让CPU执行下一条指令<BR></p>
</li>
<li><p><strong>地址寄存器(AR):</strong><BR><br>保存当前CPU当前所访问的内存单元的地址。</p>
</li>
<li><p><strong>指令译码器(ID):</strong><BR><br>我们刚才提到，指令 &#x3D; 操作码+地址码,而ID只对操作码进行分析，识别指令规定的操作，然后向操作控制器发出具体的控制信号，从而控制各个部件工作，完成所需的功能。</p>
</li>
</ul>
<h2 id="基本单位和进制转换"><a href="#基本单位和进制转换" class="headerlink" title="基本单位和进制转换:"></a>基本单位和进制转换:</h2><h3 id="基本单位和进制转换-1"><a href="#基本单位和进制转换-1" class="headerlink" title="基本单位和进制转换:"></a><strong>基本单位和进制转换:</strong></h3><h4 id="基本单位"><a href="#基本单位" class="headerlink" title="基本单位:"></a><strong>基本单位:</strong></h4><blockquote>
<p>从小到大↓<BR><br>位(比特)  b bit <BR><br>字节      B byte 1B&#x3D;8b <BR><br>千字节    KB 1KB &#x3D; 1024B &#x3D; 2<sup>10</sup> B <br><br>兆字节    MB 1MB &#x3D; 1024KB &#x3D; 2<sup>10</sup> KB<br><br>吉字节    GB 1GB &#x3D; 1024MB &#x3D; 2<sup>10</sup>MB<BR><br>太字节    TB 1TB &#x3D; 1024GB &#x3D; 2<sup>10</sup>GB<BR><br><strong>最小的数据单位：bit</strong><BR><br><strong>最小的存储单位：byte</strong></p>
</blockquote>
<h4 id="常见的几种进制"><a href="#常见的几种进制" class="headerlink" title="常见的几种进制:"></a><strong>常见的几种进制:</strong></h4><blockquote>
<p>十进制(D) 0<del>9<BR><br>二进制(B) 0</del>1<BR><br>八进制(O) 0<del>7<BR><br>十六进制(H) 0</del>F<BR></p>
</blockquote>
<h4 id="进制转换"><a href="#进制转换" class="headerlink" title="进制转换"></a><strong>进制转换</strong></h4><p> <strong>按权展开求和:</strong><br>把 <I><strong>n进制</strong></I> 转化成对应的 <I><strong>10进制</strong></I><BR><br><strong>十进制转十进制：</strong><BR></p>
<blockquote>
<p>173(D) &#x3D; 1X100 + 7X10 + 3X1 <BR><br>&#x3D; 1X10<SUP>2</SUP> + 7X10<SUP>1</SUP>+3X10<SUP>0</SUP>  &#x3D; 173(D)<BR></p>
</blockquote>
<p>同理我们也可以得到<BR><br><strong>二进制转十进制:</strong><BR></p>
<blockquote>
<p>1001001(B) →<br> 1X2<SUP>6</SUP>+0X2<SUP>5</SUP>+0X2<SUP>4</SUP>+1X2<SUP>3</SUP>+0X2<SUP>2</SUP>+0X2<SUP>1</SUP>+1X2<SUP>0</SUP> &#x3D; 73(D)</p>
</blockquote>
<h4 id="短除法"><a href="#短除法" class="headerlink" title="短除法"></a><strong>短除法</strong></h4><p><strong>八进制转十进制:</strong><br></p>
<blockquote>
<p>255(O) → 2X8<SUP>2</SUP> + 5X8<SUP>1</SUP> + 5X8<SUP>0</SUP> &#x3D; 173(D)</p>
</blockquote>
<p><strong>十六进制转十进制:</strong><BR><br>首先我们来看看十六进制的数从0到15是怎么表示的:<BR></p>
<blockquote>
<p>0 1 2 3 4 5 6 7 8 9 A B C D E F<BR><br>AD(H) &#x3D; Ax16<SUP>1</SUP> + Dx16<SUP>0</SUP> &#x3D; 173(D)</p>
</blockquote>
<p>十进制转二进制原理(短除法):<br><img src="https://img2020.cnblogs.com/blog/1646608/202007/1646608-20200708175252436-1449666235.png" alt="十进制转二进制"><br>↑如图所示,依次除2，把余数倒着写,即可</p>
<p>八进制转十进制或者十六进制转十进制方法类似，都可以使用短除法来计算。</p>
<p>PS:</p>
<blockquote>
<p>三位二进制数 对应 一位八进制数 <br><br>四位二进制数 对应 一位十六进制数</p>
</blockquote>
<h4 id="进制的加减法"><a href="#进制的加减法" class="headerlink" title="进制的加减法"></a><strong>进制的加减法</strong></h4><p><strong>原理：逢n进1</strong><br>例如10进制：</p>
<blockquote>
<p>193 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3+9 &#x3D; 12  我们把12-10 &#x3D; 2 进一<bR><br>+89 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 十位就是 9+8+1 &#x3D; 18 我们把 18 -10 &#x3D; 8 进一<BR><br>—— <BR><br>282 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 百位就是 1+1 &#x3D; 2 </p>
</blockquote>
<p>同理，十六进制也一样：</p>
<blockquote>
<p>ABDFE &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;E+4 &#x3D; 18 我们把18-16 &#x3D; 2 所以该位是2 向高位进1 <BR><br>+1024 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F+2+1 &#x3D; 18  我们把 18 - 16 &#x3D; 2 所以该位是2 向高位进1 <BR><br>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D+0+1&#x3D; 13 没有超过16 所以该位是 E <BR><br>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B+1 &#x3D; C 没有超过16 所以该位是 D <BR><br>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A无数可加 所以该位还是 A <BR><br>_ _<br>得到 ACE22</p>
</blockquote>
<h4 id="进制的减法"><a href="#进制的减法" class="headerlink" title="进制的减法"></a><strong>进制的减法</strong></h4><p><strong>原理:借1当n</strong><BR><br>例如十进制减法:<BR></p>
<blockquote>
<p>27 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;我们发现7-9不够于是向高位借1<BR><br>-9 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;所以高位减1 低位+10(也就是对应的进制n) 得到17-9&#x3D;8 <BR><br>__ <BR><br>18</p>
</blockquote>
<p>同理,二进制也一样:</p>
<blockquote>
<p>100(D) <BR><br>-&amp;nbsp;&amp;nbsp;1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;我们看见低位0-1不够，于是我们向第二个兄弟借1，发现第二个兄弟也是0，于是再向左边的第一个兄弟借1<BR><br>所以此时第一个兄弟减1 变成0   此时：020<BR><br>因为第二个兄弟向第一个兄弟借到了1 第三个兄弟还没有问第二个兄弟借到1<BR><br>所以此时:012  所有的兄弟都借到了属于自己的数&amp;nbsp;&amp;nbsp;<br>这个时候就可以减1咯<br>最后得到:<br>100(D)<BR><br>-&amp;nbsp;&amp;nbsp;1(D)<BR><br>_ _ <BR><br>011(D)<BR></p>
</blockquote>
<p>同理，十六进制和八进制也是同样的方法</p>
<h2 id="数据的表示"><a href="#数据的表示" class="headerlink" title="数据的表示:"></a>数据的表示:</h2><p>PS:<br><strong>各种数值在计算机中表示的形式称为机器数，其特点是采用二进制计数制，数的符号用0和1表示，小数点则隐含，表示不占位置。机器数对应的实际数值称为数的真值。</strong><br><strong>机器数有无符号数和带符号数之分。无符号数表示正数，在机器数中没有符号位。对于无符号数，若约定小数点的位置在机器数的最低位之后，则是纯整数:若约定小数点的位置在机器数的最高位之前，则是纯小数。对于带符号数，机器数的最高位是表示正、负的符号位，其余位则表示数值。为了便于运算，带符号的机器数可采用原码、反码和补码等不同的编码方法，机器数的这些编码方法称为码制。</strong></p>
<p><strong>为了方便运算，带符号的机器数可以采用原码、反码和补码等不同的编码方法，机器数的这些编码方法称为码制</strong> <BR><br>PS:正数的原码&#x2F;反码&#x2F;补码 完全相同 而负数的则不同</p>
<h3 id="原码"><a href="#原码" class="headerlink" title="原码:"></a><strong>原码:</strong></h3><p>在原码表示法中，最高位是符号位 0表示正号,1表示负号，其余的n-1位表示数值的绝对值。数值0的原码表示有两种形式: </p>
<blockquote>
<p>[+0]<sub>原</sub>&#x3D;0 000000，[-0]<sub>原</sub>&#x3D;1 0000000 <BR><br>[+1]<sub>原</sub> &#x3D; 0 0000001 [-1]<sub>原</sub> &#x3D; 1 0000001 <BR><br>[+127]<sub>原</sub> &#x3D; 0 1111111 [-127]<sub>原</sub> &#x3D; 1 1111111 <BR><br>[+45]<sub>原</sub> &#x3D; 0 0101101 [-45]<sub>原</sub> &#x3D; 1 0101101 <BR></p>
</blockquote>
<p>由于第一位是符号位 所以我们还有7位可以使用<br>由于每一位对于着2的n次方<BR><br>所以右到左分别是: 64 32 16 8 4 2 1<BR><br>当我们需要用原码来表示一个数字时 我们可以从右到左找到第一个比它大的数<BR> 比如我们要找:45 我们可以从右到左 发现64比45大，于是我们不看64，直接看右边的32 16 8 4 2 1，想办法凑出45来</p>
<blockquote>
<p>首先45-32 &#x3D; 13 32这个位置标记1<br>然后13-16 不够减 所以16这个位置标记0<br>然后13-8 &#x3D; 5 所以8这个位置标记1<br>然后5-4 &#x3D; 1 所以4这个位置标记1<br>然后2-1 不够减 所以2这个位置标记0<br>然后1-1 &#x3D; 0 所以1这个位置标记1<br>刚好凑出一个完整的45 然后前面的64的位 我们直接忽略了 所以我们要补一个0 <BR> </p>
</blockquote>
<p>最后我们可以凑出来一个[+45]<sub>原</sub> &#x3D; 0 0101101<BR><br>非常简单</p>
<h3 id="反码"><a href="#反码" class="headerlink" title="反码:"></a><strong>反码</strong>:</h3><p><strong>在反码表示中，最高位是符号位，0表示正号，1表示负号，正数的反码与原码相同，负数的反码则是其绝对值按位求反。数值0的反码表示有两种形式: [+0]<SUB>反</SUB> &#x3D; 0 0000000 [-0]<SUB>反</SUB>&#x3D;1 1111111</strong></p>
<p>原码转反码的方式：<br>除了符号位不变 其他的全部按位取反<BR><br>例如: </p>
<blockquote>
<p>[+1]<sub>原</sub> &#x3D; 0 0000001 [+1]<SUB>反</SUB> &#x3D; 0 1111110 <BR><br>[+45]<SUB>原</SUB> &#x3D; 0 0101101 [+45]<SUB>反</SUB> &#x3D; 0 1010010 <BR><br>[-127]<sub>原</sub> &#x3D; 1 1111111 [-127]<sub>反</sub> &#x3D; 1 0000000 <BR></p>
</blockquote>
<h3 id="补码"><a href="#补码" class="headerlink" title="补码:"></a><strong>补码</strong>:</h3><p><strong>在补码表示中，最高位为符号位，0表示正号，!表示负号,正数的补码与其原码和反码相同,负数的补码则等于其反码的末位加1.在补码表示中,0有唯一的编码: [+0]<sub>补</sub> &#x3D; 0 0000000</strong></p>
<p>例如:</p>
<blockquote>
<p>[-3]<sub>反</sub>1 1111100 [-3]<sub>补</sub>1 1111101 <BR><br>[-127]<sub>反</sub> &#x3D; 1 0000000 [-127]<sub>补</sub> &#x3D;  1 0000001<BR><br>[+45]<sub>补</sub>0 0101101 [-45]<sub>补</sub>1 1010011<br><br>一个特性:补码 的 补码 &#x3D; 原码</p>
</blockquote>
<h3 id="移码"><a href="#移码" class="headerlink" title="移码:"></a><strong>移码</strong>:</h3><p><strong>将补码的符号位取反即可</strong></p>
<blockquote>
<p>[-3]<sub>补</sub>1 1111101 [-3]<SUB>移</sub>0 1111101 <BR><br>[-127]<sub>补</sub> &#x3D;  1 0000001 [-127]<SUB>移</SUB>0 0000001<BR><br>[+45]<sub>补</sub>0 0101101 [+45]<SUB>移</SUB>1 0101101<BR><br>[-45]<sub>补</sub>1 1010011 [-45]<SUB>移<SUB>0 1010011<br></p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://cristor404.gitee.io">Cristor404</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://cristor404.gitee.io/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/">https://cristor404.gitee.io/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://cristor404.gitee.io" target="_blank">Cristor404</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage1.big-bit.com%2F2021%2F0510%2F20210510024124509.jpeg&amp;refer=http%3A%2F%2Fimage1.big-bit.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1672154822&amp;t=49b9b7598a8c874b43bcce547cc000a3" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2022/11/27/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/"><img class="prev-cover" src="http://mms0.baidu.com/it/u=1186296230,3449077382&amp;fm=253&amp;app=138&amp;f=PNG&amp;fmt=auto&amp;q=75?w=634&amp;h=291" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">排序算法</div></div></a></div><div class="next-post pull-right"><a href="/2022/09/20/HuffmanTreeTest/"><img class="next-cover" src="https://img-blog.csdnimg.cn/c2b374c28c4f4bab87091984fee27a2c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAQ3Jpc3RvcjQwNA==,size_20,color_FFFFFF,t_70,g_se,x_16" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Huffman树的编码与译码</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://s2.loli.net/2022/09/19/8IjdtLPKe9b7vUg.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Cristor404</div><div class="author-info__description">分享一些个人学习的心得</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">8</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Cristor404"><i class="fab fa-github"></i><span>关 注 我</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Cristor404" target="_blank" title=""><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2412215074@qq.com" target="_blank" title=""><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://music.163.com/#/artist?id=1158066" target="_blank" title=""><i class="fa-solid fa-music"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">会不定期的更新一些文章哦</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E3%80%8A%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86%E3%80%8B-%E3%81%AE%E7%AC%94%E8%AE%B0"><span class="toc-number">1.</span> <span class="toc-text">《计算机系统基础知识》 の笔记</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%9A%84%E5%9F%BA%E6%9C%AC%E7%A1%AC%E4%BB%B6%E7%B3%BB%E7%BB%9F%E7%BB%84%E6%88%90"><span class="toc-number">1.1.</span> <span class="toc-text">计算机的基本硬件系统组成</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#CPU"><span class="toc-number">1.1.1.</span> <span class="toc-text">CPU:</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%90%E7%AE%97%E5%99%A8%EF%BC%9A"><span class="toc-number">1.1.1.1.</span> <span class="toc-text">运算器：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%8E%A7%E5%88%B6%E5%99%A8%EF%BC%9A"><span class="toc-number">1.1.1.2.</span> <span class="toc-text">控制器：</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%8D%95%E4%BD%8D%E5%92%8C%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2"><span class="toc-number">1.2.</span> <span class="toc-text">基本单位和进制转换:</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%8D%95%E4%BD%8D%E5%92%8C%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2-1"><span class="toc-number">1.2.1.</span> <span class="toc-text">基本单位和进制转换:</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E5%8D%95%E4%BD%8D"><span class="toc-number">1.2.1.1.</span> <span class="toc-text">基本单位:</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E7%9A%84%E5%87%A0%E7%A7%8D%E8%BF%9B%E5%88%B6"><span class="toc-number">1.2.1.2.</span> <span class="toc-text">常见的几种进制:</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2"><span class="toc-number">1.2.1.3.</span> <span class="toc-text">进制转换</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E7%9F%AD%E9%99%A4%E6%B3%95"><span class="toc-number">1.2.1.4.</span> <span class="toc-text">短除法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%88%B6%E7%9A%84%E5%8A%A0%E5%87%8F%E6%B3%95"><span class="toc-number">1.2.1.5.</span> <span class="toc-text">进制的加减法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%BF%9B%E5%88%B6%E7%9A%84%E5%87%8F%E6%B3%95"><span class="toc-number">1.2.1.6.</span> <span class="toc-text">进制的减法</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%B0%E6%8D%AE%E7%9A%84%E8%A1%A8%E7%A4%BA"><span class="toc-number">1.3.</span> <span class="toc-text">数据的表示:</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8E%9F%E7%A0%81"><span class="toc-number">1.3.1.</span> <span class="toc-text">原码:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%8D%E7%A0%81"><span class="toc-number">1.3.2.</span> <span class="toc-text">反码:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A1%A5%E7%A0%81"><span class="toc-number">1.3.3.</span> <span class="toc-text">补码:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%A7%BB%E7%A0%81"><span class="toc-number">1.3.4.</span> <span class="toc-text">移码:</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/01/03/%E5%9F%BA%E6%9C%AC%E5%88%9D%E7%AD%89%E5%87%BD%E6%95%B0/" title="无题"><img src="https://s2.loli.net/2022/09/19/pSDUbnYN2LJ61Is.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="无题"/></a><div class="content"><a class="title" href="/2023/01/03/%E5%9F%BA%E6%9C%AC%E5%88%9D%E7%AD%89%E5%87%BD%E6%95%B0/" title="无题">无题</a><time datetime="2023-01-03T13:08:00.357Z" title="发表于 2023-01-03 21:08:00">2023-01-03</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/11/27/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/" title="排序算法"><img src="http://mms0.baidu.com/it/u=1186296230,3449077382&amp;fm=253&amp;app=138&amp;f=PNG&amp;fmt=auto&amp;q=75?w=634&amp;h=291" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="排序算法"/></a><div class="content"><a class="title" href="/2022/11/27/%E6%8E%92%E5%BA%8F%E7%AE%97%E6%B3%95/" title="排序算法">排序算法</a><time datetime="2022-11-27T11:30:00.000Z" title="发表于 2022-11-27 19:30:00">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/" title="Cristor计算机系统的笔记"><img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage1.big-bit.com%2F2021%2F0510%2F20210510024124509.jpeg&amp;refer=http%3A%2F%2Fimage1.big-bit.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1672154822&amp;t=49b9b7598a8c874b43bcce547cc000a3" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Cristor计算机系统的笔记"/></a><div class="content"><a class="title" href="/2022/09/20/Crsitor%E7%9A%84%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E7%AC%94%E8%AE%B0/" title="Cristor计算机系统的笔记">Cristor计算机系统的笔记</a><time datetime="2022-09-20T12:30:00.000Z" title="发表于 2022-09-20 20:30:00">2022-09-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/09/20/HuffmanTreeTest/" title="Huffman树的编码与译码"><img src="https://img-blog.csdnimg.cn/c2b374c28c4f4bab87091984fee27a2c.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAQ3Jpc3RvcjQwNA==,size_20,color_FFFFFF,t_70,g_se,x_16" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Huffman树的编码与译码"/></a><div class="content"><a class="title" href="/2022/09/20/HuffmanTreeTest/" title="Huffman树的编码与译码">Huffman树的编码与译码</a><time datetime="2022-09-20T08:09:00.000Z" title="发表于 2022-09-20 16:09:00">2022-09-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/09/20/%E5%AE%B9%E5%99%A8%E5%8C%96%E4%B8%80%E4%B8%AAJava%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F/" title="容器化Java应用程序"><img src="https://img1.baidu.com/it/u=4236520888,410323430&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPG?w=918&amp;h=500" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="容器化Java应用程序"/></a><div class="content"><a class="title" href="/2022/09/20/%E5%AE%B9%E5%99%A8%E5%8C%96%E4%B8%80%E4%B8%AAJava%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F/" title="容器化Java应用程序">容器化Java应用程序</a><time datetime="2022-09-20T08:09:00.000Z" title="发表于 2022-09-20 16:09:00">2022-09-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023 By Cristor404</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    chtml: {
      scale: 1.2
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        insertScript: [200, () => {
          document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
            const target = node.parentNode
            if (target.nodeName.toLowerCase() === 'li') {
              target.parentNode.classList.add('has-jax')
            } else {
              target.classList.add('has-jax')
            }
          });
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax/es5/tex-mml-chtml.min.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css"><script src="https://cdn.jsdelivr.net/npm/katex/dist/contrib/copy-tex.min.js"></script><script>(() => {
  document.querySelectorAll('#article-container span.katex-display').forEach(item => {
    btf.wrap(item, 'div', { class: 'katex-wrap'})
  })
})()</script></div><div class="aplayer no-destroy" data-id="7475464662" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay="false" muted></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>